home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / programming / amos / amoslist-0295.lzh / AMOSLIST / text0140.txt < prev    next >
Encoding:
Text File  |  1995-03-01  |  4.7 KB  |  124 lines

  1. Peter Custerson spake thus:
  2. > Could somebody please explain the theory of 4 way scrolling maps
  3. > to me.
  4. > At the moment we have a physical screen 320 x 200 Lowres 32 col
  5. > And a Screen Display (Viewport) of 256 x 192 offset to the
  6. > center of the screen leaving a block of 32 all the way around
  7. > the screen.  We can scroll all the way around the physical
  8. > screen, smoothly no trouble at all.  How can we make the scrolling
  9. > area bigger without creating a huge physical screen eating up all
  10. > our memory?
  11. >
  12. > We have tried various methods including -
  13. > when we reach the end of the physical screen - copy all the
  14. > relevant blocks to the centre and resetting the viewport, but of
  15. > course this is very SLOOOOOOW.
  16. >
  17. > Could somebody tell me the correct way of doing this, and perhaps
  18. > provide a piece of AMOS code.  If there an AMOS archive somewhere
  19. > on the net?
  20. >
  21. > Thanks in Advance
  22. >
  23. >        Pete.
  24.  
  25. OK... sorry I've taken longer than usual to reply to this.
  26.  
  27. Right, I've done this before, and basically, what I had to do is create
  28. a screen which is 2x2 times the size of the bit you actually see... then
  29. you'll have to maintain 4 copies of the bit you're looking at. This
  30. allows you to gradually scroll further and further to the right, then
  31. suddenly jump back one screen width without noticable effects. I'll give
  32. a 2-way scrolling example, because it's more brief, but you can easily
  33. extend this to 4-way (which is almosy identical to 8-way - I suspect you
  34. mean 8-way, actually - most people do.)
  35.  
  36. Right. You have a large screen, and for some odd reason, you want to
  37. scroll smoothly all the way through large letters of the alphabet
  38. without creating a screen wide enough for all 26. These are BIG letters,
  39. and only 4 can fit on the screen at once. You DO NOT want to do it this
  40. way:
  41.  
  42. +-------+>>>
  43. |A B C D|E F G H I J K L M N O P Q R S T U V W X Y Z
  44. |A B C D|E F G H I J K L M N O P Q R S T U V W X Y Z
  45. +-------+>>>
  46.  
  47. You don't want to do it like that, because it would need a huge screen.
  48. If you, however, create a screen which is JUST OVER twice the width, you
  49. can do something like this:
  50.  
  51. +-------+>>>
  52. |A B C D|E A B C D E
  53. |A B C D|E A B C D E
  54. +-------+>>>
  55.  
  56. You gradually scroll the screen until the "E" has finished appearing,
  57. then you prepare the next column of the screen:
  58.  
  59.   +-------+>>>
  60.  F|B C D E|F B C D E
  61.  F|B C D E|F B C D E
  62.   +-------+>>>
  63.  
  64. Note that I'm keeping 2 identical copies of an identical screen. Now,
  65. keep going, scrolling and preaparing TWO COPIES of the next column,
  66. until you reach this point:
  67.  
  68.           +-------+>>>                  +-------+
  69.  F G H I J|F G H I|J            Player  |F G H I|
  70.  F G H I J|F G H I|J            sees:   |F G H I|
  71.           +-------+>>>                  +-------+
  72.  
  73. Now, if you suddenly jump back a screen-width, the stuff you see on the
  74. screen is IDENTICAL, so you never notice the change:
  75.  
  76. +-------+>>>                            +-------+
  77. |F G H I|J F G H I J            Player  |F G H I|
  78. |F G H I|J F G H I J            sees:   |F G H I|
  79. +-------+>>>                            +-------+
  80.  
  81. Now you're basically back where you started. You can continue to scroll
  82. to the right, updating BOTH COPIES of the screen.
  83.  
  84. Now, I won't repeat all of that for 8-directional scrolling, but
  85. basically you'll need FOUR copies of the stuff you're seeing, like this:
  86.  
  87. +-------+
  88. |A B C D|E A B C D E
  89. |F G H I|J F G H I J
  90. +-------+O K L M N O
  91.  A B C D E A B C D E
  92.  F G H I J F G H I J
  93.  K L M N O K L M N O
  94.  
  95. Now... Something that you may have noticed... In Amos, and a lot of
  96. other environments... If you scroll OFF THE RIGHT-HAND SIDE of the
  97. screen, you start seeing the left-hand side again, only shifted up by a
  98. pixel. When you think about the way screen memory works, this is
  99. blindingly obvious. In *SOME* circumstances, this single-pixel "jump" is
  100. unimportant to the game, and you're never going to need to draw anything
  101. half-way across the gap. *IF* you don't mind these restrictions, you
  102. don't even need to make your screen twicxe the width - you can just
  103. scroll into the "next copy" of the same screen, and occasionally jump up
  104. a pixel to compensate. In most cases, you'll have to put up with a 2x2
  105. size screen though.
  106.  
  107. Note! This trick only works HORIZONTALLY! You can scroll off the right
  108. and "sort of" back on the left, but you absolutely CANNOT do the same
  109. off the top or bottom... You *WILL* need twice the height.
  110.  
  111. If you have problems with the above, let me know, but I'm quite busy,
  112. and off on a skiing holiday soonish, so don't be surprised if I take
  113. ages replying.
  114.  
  115. Definite sense of Deja Vu here... Don'tcha reckon, M+F?   ;-)
  116.  
  117.  
  118.   Nick Waterman - inet nick@cimio.co.uk - ax25 G7RZQ @ GB7DEO.#32.GBR.EU
  119. "Go to Red Alert!"... "Sir, are you sure? It DOES mean changing the bulb!"
  120.       None of the opinions above belong to anybody at all, probably.
  121.  
  122.  
  123.  
  124.